home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacApp Release 10 / MacApp Release 10 - HD Ready / Libraries / Views / Includes / UTabBehaviors.h < prev    next >
Encoding:
Text File  |  1996-04-03  |  4.3 KB  |  134 lines  |  [TEXT/MPS ]

  1. // UTabBehaviors.h
  2. // Copyright © 1984-96 by Apple Computer, Inc. All rights reserved.
  3.  
  4. #ifndef __UTABBEHAVIORS__
  5. #define __UTABBEHAVIORS__
  6.  
  7. // MacApp
  8.  
  9. #ifndef __UBEHAVIOR__
  10. #include "UBehavior.h"
  11. #endif
  12.  
  13. //----------------------------------------------------------------------------------------
  14. // Forward and external class declarations. 
  15. //----------------------------------------------------------------------------------------
  16.  
  17. class TView;
  18.  
  19. //----------------------------------------------------------------------------------------
  20. // TTabber
  21. //----------------------------------------------------------------------------------------
  22.  
  23. // An abstract parent class for tabbing behaviors which intercept the Tab key event
  24. // and find the next view which wishes to become the target
  25.  
  26. const IDType kTabBehavior = 'tabb';    // Behavior identifier
  27.  
  28. class TTabber : public TBehavior
  29. {
  30.     MA_DECLARE_CLASS;
  31.     
  32. public:
  33.     Boolean fRecursive;        // True if the search should include the entire view hierarchy
  34.                             // false if it should be limited to immediate subviews
  35.     Boolean fFoundCurrent;    // Set to true when the current target has been found
  36.     TView*    fFirst;            // Save the first potential target (to do wraparound)
  37.     TView*    fNext;            // The view which becomes the new target.
  38.  
  39.     //------------------------------------------------------------------------------------
  40.     // Constructor
  41.     //------------------------------------------------------------------------------------
  42.  
  43.     TTabber();
  44.         // Constructor
  45.     virtual ~TTabber();
  46.         // Destructor
  47.         
  48.     void ITabber(Boolean recursive);
  49.  
  50.     //------------------------------------------------------------------------------------
  51.     // Stream I/O protocol support.
  52.     //------------------------------------------------------------------------------------
  53.  
  54.     virtual void ReadFrom(TStream* aStream);
  55.  
  56.     virtual void WriteTo(TStream* aStream);
  57.  
  58.     //------------------------------------------------------------------------------------
  59.     // Event handling.
  60.     //------------------------------------------------------------------------------------
  61.  
  62.     virtual void DoKeyEvent(TToolboxEvent* event);
  63.     virtual void Tab(Boolean tabBackward);
  64.     virtual void Reset();
  65.     virtual void FindSubViewTargets(TView* parent,
  66.                                            Boolean tabBackward);
  67.     virtual void FindTargets(Boolean tabBackward);
  68.  
  69.     virtual IDType GetStandardSignature();
  70.         // Return the standard signature for this class
  71. };
  72.  
  73. //----------------------------------------------------------------------------------------
  74. // TMultiWindowTabber
  75. //----------------------------------------------------------------------------------------
  76.  
  77. // Attached to the application object. Handles tabbing across multiple active
  78. // windows (i.e. when windoids are present)
  79.  
  80. class TMultiWindowTabber : public TTabber
  81. {
  82.     MA_DECLARE_CLASS;
  83.     
  84. public:
  85.     //------------------------------------------------------------------------------------
  86.     // Constructor
  87.     //------------------------------------------------------------------------------------
  88.  
  89.     TMultiWindowTabber();
  90.         // Empty constructor to satisfy compiler.
  91.     virtual ~TMultiWindowTabber();
  92.         // Destructor
  93.         
  94.     void IMultiWindowTabber(Boolean recursive);
  95.  
  96.     //------------------------------------------------------------------------------------
  97.     // Event handling.
  98.     //------------------------------------------------------------------------------------
  99.  
  100.     virtual void FindTargets(Boolean tabBackward);    // Override
  101. };
  102.  
  103. //----------------------------------------------------------------------------------------
  104. // TViewTabber
  105. //----------------------------------------------------------------------------------------
  106.  
  107. // Can be attached to any view to intercept the Tab key before it gets to the
  108. // MultiWindowTabber in the application 
  109.  
  110. class TViewTabber : public TTabber
  111. {
  112.     MA_DECLARE_CLASS;
  113.     
  114. public:
  115.     //------------------------------------------------------------------------------------
  116.     // Constructor
  117.     //------------------------------------------------------------------------------------
  118.  
  119.     TViewTabber();
  120.         // Empty constructor to satisfy compiler.
  121.     virtual ~TViewTabber();
  122.         // Destructor
  123.         
  124.     void IViewTabber(Boolean recursive);
  125.  
  126.     //------------------------------------------------------------------------------------
  127.     // Event handling.
  128.     //------------------------------------------------------------------------------------
  129.  
  130.     virtual void FindTargets(Boolean tabBackward);    // Override
  131. };
  132.  
  133. #endif
  134.